﻿<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<CRM.Models.Settlements>" %>

<script type="text/javascript">
//<![CDATA[
    function OnGridFocusedRowChanged(s, e) {

        s.GetRowValues(s.GetFocusedRowIndex(), 'IdSettlement;NameRu', OnGetRowValues);
        e.customArgs["SelectedSettlement"] = IdSettlement.GetKeyValue();
    }
    function OnGetRowValues(values) {
       // alert("!!");
        IdSettlement.SetKeyValue(values[0]);
        IdSettlement.SetText(values[1]);
      //  alert(IdSettlement.GetKeyValue());
      //  alert(ddSettlement.GetValue());
        
      //  alert(ddSettlement.GetKeyValue());
        //        DetailPhoto.SetImageUrl("@GridViewDemosHelper.GetEmployeeImageRouteUrl()?@GridViewDemosHelper.ImageQueryKey=" + values[0]);
        //        DetailNotes.SetText(values[1]);
    }
    
    function TextChanged() {
        alert("fd");
    }

    function DD_Init(s, e) {
        alert("DD_Init");
    }
    
// ]]>
</script>


<% 
    using (Html.BeginForm())
    {

        Html.DevExpress().DropDownEdit(settings =>
                                           {
                                               settings.Name = "IdSettlement";

                                               settings.SetDropDownWindowTemplateContent(c =>
                                                                                             {
                                                                                                 Html.RenderPartial(
                                                                                                     "SettlementsChooserGrid",
                                                                                                     Model);
                                                                                             });

                                               // settings.Properties.ClientSideEvents.Init = "DD_Init";
                                               // settings.Properties.ClientSideEvents.TextChanged = "function() { alert('asd'); }";

                                           }).Bind(Model.NameRu).Render();


%>

         <input type="submit" value="Save" />
         <% } %>

